﻿/***********************************************************************
 * <copyright file="CustomerEntity.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoàng Bích Sơn
 * Email:    sonhb@buca.vn
 * Website:
 * Create Date: Friday, March 7, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/


using BusinessObjects.BusinessRules;

namespace BusinessObjects.BussinessDictionary
{

    /// <summary>
    /// CustomerEntity class
    /// </summary>
    public class Customer : BusinessObject 
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="Customer"/> class.
        /// </summary>
        public Customer()
        {
            //validateId
            AddRule(new ValidateId("CustomerId"));
            //validateRequired
            //AddRule(new ValidateRequired("UnitID"));
            AddRule(new ValidateRequired("Code"));
            AddRule(new ValidateRequired("Name"));
            AddRule(new ValidateRequired("IsActive"));
            //validateLength
            AddRule(new ValidateLength("Code", 0, 20));
            AddRule(new ValidateLength("Name", 0, 255));
            //AddRule(new ValidateLength("Fax", 0, 20));
            //AddRule(new ValidateLength("Address", 0, 255));
            //AddRule(new ValidateLength("PhoneNumber", 0, 20));
            //AddRule(new ValidateLength("ContactName", 0, 255));
            //AddRule(new ValidateLength("CompanyName", 0, 255));
            //AddRule(new ValidateLength("Description", 0, 255));
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Customer"/> class.
        /// </summary>
        /// <param name="customerId">The customer identifier.</param>
        /// <param name="unitId">The unit identifier.</param>
        /// <param name="code">The code.</param>
        /// <param name="name">The name.</param>
        /// <param name="address">The address.</param>
        /// <param name="phoneNumber">The phone number.</param>
        /// <param name="fax">The fax.</param>
        /// <param name="companyName">Name of the company.</param>
        /// <param name="contactName">Name of the contact.</param>
        /// <param name="description">The description.</param>
        /// <param name="isActive">if set to <c>true</c> [is active].</param>
        public Customer(int customerId, long unitId, string code, string name, string address,
                        string phoneNumber, string fax, string companyName, string contactName, string description,
                        bool isActive)
            : this()
        {
            CustomerId = customerId;
            UnitId = unitId;
            Code = code;
            Name = name;
            Address = address;
            PhoneNumber = phoneNumber;
            Fax = fax;
            CompanyName = companyName;
            ContactName = contactName;
            Description = description;
            IsActive = isActive;
        }

        /// <summary>
        /// Gets or sets the customer identifier.
        /// </summary>
        /// <value>
        /// The customer identifier.
        /// </value>
        public int CustomerId { get; set; }

        /// <summary>
        /// Gets or sets the unit identifier.
        /// </summary>
        /// <value>
        /// The unit identifier.
        /// </value>
        public long UnitId { get; set; }

        /// <summary>
        /// Gets or sets the code.
        /// </summary>
        /// <value>
        /// The code.
        /// </value>
        public string Code { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the address.
        /// </summary>
        /// <value>
        /// The address.
        /// </value>
        public string Address { get; set; }

        /// <summary>
        /// Gets or sets the phone number.
        /// </summary>
        /// <value>
        /// The phone number.
        /// </value>
        public string PhoneNumber { get; set; }

        /// <summary>
        /// Gets or sets the fax.
        /// </summary>
        /// <value>
        /// The fax.
        /// </value>
        public string Fax { get; set; }

        /// <summary>
        /// Gets or sets the name of the company.
        /// </summary>
        /// <value>
        /// The name of the company.
        /// </value>
        public string CompanyName { get; set; }

        /// <summary>
        /// Gets or sets the name of the contact.
        /// </summary>
        /// <value>
        /// The name of the contact.
        /// </value>
        public string ContactName { get; set; }

        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value>
        /// The description.
        /// </value>
        public string Description { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [is active].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [is active]; otherwise, <c>false</c>.
        /// </value>
        public bool IsActive { get; set; }
    }
}
